﻿/// <reference path="../lib/openlayers3/ol.js" />
/// <reference path="../lib/angular/angular-1.3.0.min.js" />
/// <reference path="../lib/angular/angular-resource.js" />
var mapServices = angular.module('mapServices', ['ngResource']);

mapServices.factory('Maps', ['$resource', function ($resource) {
    return $resource('services/maps/maps.json', {}, {
        query: {
            method: 'GET',
            isArray: true
        }
    });
}]);

mapServices.factory('LayerFactory', function () {
    return {
        createLayer: function (p) {
            //XYZ
            if (p.type == 'XYZ') {
                return new ol.layer.Tile({
                    title: p.name,
                    visible: p.open,
                    source: new ol.source.XYZ({
                        url: p.url
                    })
                });
            }
            //WMTS todo
            if (p.type == 'WMTS') {
            }
        }
    };
});